package com.cy.mall.web.front.store;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cy.mall.model.PageBean;
import com.cy.mall.model.Result;
import com.cy.mall.model.query.store.StoreListQuery;
import com.cy.mall.model.vo.store.EnableStoreListVO;
import com.cy.mall.model.vo.store.StoreListVO;
import com.cy.mall.service.store.StoreService;
import com.cy.mall.web.BaseController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 前台-门店管理
 *
 * @author tanyilin
 *
 * @create 2019年1月24日 下午3:27:12
 */
@RestController
@RequestMapping("/store")
@Api(tags = "前台-门店管理")
public class StoreController extends BaseController {

	@Autowired
	private StoreService storeService;
	
	@ApiOperation("门店列表")
	@GetMapping("/get/list")
	public PageBean<StoreListVO> getStoreList(StoreListQuery query) {
		PageBean<StoreListVO> pageBean = storeService.selectStoreList(query);
		return pageBean;
	}
	
	@ApiOperation("查询某品牌启用状态的门店列表")
	@GetMapping("/get/all/enable/list")
	public Result<List<EnableStoreListVO>> getAllEnableList(@RequestParam(value = "brandId") Long brandId) {
		List<EnableStoreListVO> list = storeService.allEnableStoreList(brandId);
		return ok("", list);
	}
	
	
	
}
